// 导入类
import Model from '../utils/request.js'
//继承类的方法
class Api extends Model {
	constructor(baseUrl) {
		super(baseUrl)
		this.baseUrl = baseUrl
	}
	// 发送验证码
	login = data => this.post(`/users-login`, data)
	//微信授权登陆
	loginNode = (data, data1, data2, data3) => this.post(
			`/wechat/miniSignUp?loginCode=${data}&phoneCode=${data1}`)
	//首页推荐
	flowing = data => this.get(`/following`)
	//首页关注
	recommend = data => this.get(`/recommend`)
	//获取用户感兴趣的计划
	getUserPlans = data => this.get(`/plans/user?type=${data}`)
	//获取详情
	detail = data => this.get(`/plan/detail/${data}`)
	//点赞
	collect = (id, params) => this.post(`/plans/${id}`, params)
	//获取评论
	getPlan = data => this.get(`/plans/${data}/comment`)
	/**
	 * @function 创建评论
	 */
	addPlan = (data) => this.post(`/plans/${data.planUuid}/comment`, data)
	//展开子评论
	getPlan1 = (data, data1) => this.get(`/plans/${data}/subComment`, data1)
	/** 
	 * @function 评论点赞
	 */
	commentLike = (data) => this.post(`/plans/${data.uuid}/commentLike`, data)
	/**
	 * @function 撤回点赞
	 */
	deleteCommentLike = (data) => this.delete(`/plans/${data.uuid}/commentLike`, data)
	/**
	 * @function 删除评论
	 */
	deleteComment = (data) => this.delete(`/plans/${data.uuid}/comment`, data)
	//用户关注用户
	fool = data => this.get(`/user-followings/${data}`)
	fool1 = data => this.post(`/user-followings`, data)
	fool2 = data => this.delete(`/user-followings`, data)
	//获取用户信息
	getUserInfor = data => this.get(`/users/detail/`)
	//获取对方主页个人信息
	getPer = data => this.get(`/users/detail/${data}`)
	//获取对方主页笔记
	getPerNote = data => this.get(`/plans/user/other/${data}`)
	//获取对方收藏数据
	getPerColl = data => this.get(`/plans/user/other/${data}/save`)
	//改变计划状态
	updateStatus = (data, data1) => this.put(`/plans/status?planUuid=${data}&status=${data1}`)
	//我的主页数据
	myData = data => this.get(`/plans/user/filter?status=${data}&privateView=false`)
	myData1 = data => this.get(`/plans/user/filter?privateView=${data}`)
	myData2 = data => this.get(`/plans/user/filter?status=${data}`)
	//获取粉丝列表
	fanList = data => this.get(`/user-fans`)
	//查询用户关注的用户
	care = data => this.get(`/user-followings`)
	//地图信息
	map = data => this.get(`/poi/${data}`)
	/**
	 * @function 对话推荐词条
	 */
	chatRecommend = data => this.get(`/chat/recommend`)
	/** 
	 * @function 保存计划
	 */
	plansSave = data => this.post(`/plans/save`, data)

	/** 
	 * @function 获取计划
	 */
	getPlans = data => this.get(`/plans/${data}`)

	/** 
	 * @function 改变计划状态
	 */
	plansStatus = data => this.put(`/plans/status?planUuid=${data.planUuid}&status=${data.status}`)
	/** 
	 * @function 删除上传图片
	 */
	deletePlansImage = data => this.delete(`/deletePlan/image?plan_uuid=${data.planUuid}&img_url=${data.imgUrl}`)
	/** 
	 * @function 更新用户信息
	 */
	updateUser = data => this.put(`/users`,data)
	
	/** 
	 * @function 隐私协议
	 */
	userPrivacy = data => this.get(`/privacy`)
	/**
	 * @function 用户协议
	 */
	userProtocol = data => this.get(`/user/protocol`)
}
const api = new Api();
export default api
